#include "stdafx.h"
#include "ckEnumField.h"
#include "ckField.h"

namespace ck
{
	namespace data
	{
		EnumField::EnumField()
		{
			m_iter = m_fields.begin();
		}


		EnumField::~EnumField()
		{
			Cleanup();
		}

		void EnumField::Add(Field* pCase)
		{
			if (pCase)
			{
				m_fields.push_back(pCase);
			}
		}

		void EnumField::Cleanup()
		{
			std::vector<Field*>::iterator iter;
			for (iter = m_fields.begin(); iter != m_fields.end(); iter++)
			{
				(*iter)->Release();
			}
			m_fields.clear();
		}

		void EnumField::Reset()
		{
			m_iter = m_fields.begin();
		}

		Field* EnumField::Next()
		{
			if (m_iter == m_fields.end())
			{
				return NULL;
			}
			return *(m_iter++);
		}

	}
}
